// ********************************************************************************************
// Table 2: Determinants of parcel coverage (establishment building footprint over parcel size)
// ********************************************************************************************

// Writes the results as reg_coverage to $resultpath/tables/

use "$outpath/database_for_reg.dta", clear

eststo clear

global instruct "tdec(3) rdec(3) auto(3) bdec (3) symbol($^a$,$^b$,$^c$) se e(r2_p) tex label nocons"

xi: reghdfe ratio Lnpopcma Lnareacma dist_min_NEW i.cat0 spacematep spacematep2 spacematep3 spacematep4 if samplep==1, absorb(naics4d eruid) cluster(cmauid)
outreg2 using "$resultpath/tables/reg_coverage.xls", replace $instruct

xi: reghdfe ratio Lnpopcma Lnareacma dist_min_NEW i.cat0 spacematep spacematep2 spacematep3 spacematep4 Lnemp if samplep==1, absorb(naics4d eruid) cluster(cmauid)
outreg2 using "$resultpath/tables/reg_coverage.xls", append $instruct

xi: reghdfe ratio Lnpopcma Lnareacma dist_min_NEW i.cat0 spacematep spacematep2 spacematep3 spacematep4 Lnemp i.hoffice i.exports NBdiffbusiness NBdiffnaics4 NBdiffproduct if samplep==1, absorb(naics4d eruid) cluster(cmauid)
outreg2 using "$resultpath/tables/reg_coverage.xls", append $instruct

xi: reghdfe ratio Lnpopcma Lnareacma dist_min_NEW i.cat0 spacematep spacematep2 spacematep3 spacematep4 Lnemp i.hoffice i.exports NBdiffbusiness NBdiffnaics4 NBdiffproduct Lndist_maj_air Lndist_maj_sea Lndist_stat_freight Lndist_junction if samplep==1, absorb(naics4d eruid) cluster(cmauid)
outreg2 using "$resultpath/tables/reg_coverage.xls", append $instruct

xi: reghdfe ratio Lnpopcma Lnareacma Lnda_density05 dist_min_NEW i.cat0 spacematep spacematep2 spacematep3 spacematep4 Lnemp i.hoffice i.exports NBdiffbusiness NBdiffnaics4 NBdiffproduct Lndist_maj_air Lndist_maj_sea Lndist_stat_freight Lndist_junction if samplep==1, absorb(naics4d eruid) cluster(cmauid)
outreg2 using "$resultpath/tables/reg_coverage.xls", append $instruct

global instruct "tdec(3) rdec(3) auto(3) bdec (3) symbol($^a$,$^b$,$^c$) se e(r2_p) tex label nocons stats(beta pval) "

xi: reg ratio Lnpopcma Lnareacma dist_min_NEW i.cat0 i.naics4d i.eruid spacematep spacematep2 spacematep3 spacematep4 Lnemp i.hoffice i.exports NBdiffbusiness NBdiffnaics4 NBdiffproduct Lndist_maj_air Lndist_maj_sea Lndist_stat_freight Lndist_junction if samplep==1, beta ro
outreg2 using "$resultpath/tables/reg_coverage.xls", append $instruct keep(Lnpopcma Lnareacma Lnda_density05 dist_min_NEW _Icat0_2  _Icat0_3 _Ihoffice_2  _Iexports_2 spacematep spacematep2 spacematep3 spacematep4 Lnemp  NBdiffbusiness NBdiffnaics4 NBdiffproduct Lndist_maj_air Lndist_maj_sea Lndist_stat_freight Lndist_junction)
